package com.qk.mapper;

import com.qk.entity.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RoleMapper {

    //根据角色查询列表
    //@Select("select * from role where name like concat('%',#{name},'%') and label like concat('%',#{label},'%')")
    List<Role> selectlist(String name, String label);

//添加角色
    @Insert("insert into role(name,label,create_time,update_time) values(#{name},#{label},#{createTime},#{updateTime})")
    void insert(Role role);
//根据id查询角色
    @Select("select * from role where id=#{id}")

    Role selectById(Integer id);
//删除角色
    @Delete("delete from role where id= #{id}")
    void deleteById(Integer id);
//修改角色
    @Update("update role set name=#{name},label=#{label},update_time=#{updateTime} where id=#{id}")
    void update(Role role);
//6、查询所有角色
    @Select("select * from role")
    List<Role> getAllRoles();
}
